// Tags:
#include <algorithm>
#include <cstdio>

const int N = 2e5 + 5e4 + 5, M = 1e7 + 5;
int k, cnt;
long long a[N], fac[M], n;
bool f[M];

long long getgcd(long long a, long long b) { return b ? getgcd(b, a % b) : a; }

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3518 [POI2011]SEJ-Strongbox.in", "r", stdin);
  freopen("P3518 [POI2011]SEJ-Strongbox.out", "w", stdout);
#endif
#endif

  scanf("%lld%d", &n, &k);
  for (int i = 1; i <= k; ++i) { scanf("%lld", &a[i]); }
  a[k] = getgcd(a[k], n);
  for (int i = 1; 1ll * i * i <= a[k]; ++i) {
    if (a[k] % i == 0) {
      fac[++cnt] = i;
      if (1ll * i * i != a[k]) fac[++cnt] = a[k] / i;
    }
  }
  std::sort(fac + 1, fac + cnt + 1);
  for (int i = 1; i < k; ++i) {
    f[std::lower_bound(fac + 1, fac + cnt + 1, getgcd(a[k], a[i])) - fac] =
        true;
  }
  for (int i = 1; i <= cnt; ++i)
    if (f[i])
      for (int j = 1; j < i; ++j)
        if (fac[i] % fac[j] == 0) f[j] = 1;
  int p = 0;
  while (f[++p]) {}
  printf("%lld", n / fac[p]);
  return 0;
}